/***
 * 测试6：给服务器上传一个大文件，服务器将文件保存下来，观察处理结果
 */

#include "../source/server.hpp"
#include "../source/http/http.hpp"

int main()
{
    Socket socket;
    socket.CreateClient(8080, "127.0.0.1");
    std::string str = "PUT /1234.txt HTTP/1.1\r\nConnection: keep-alive\r\n";
    std::string body;
    Util::ReadFile("./hello.txt", &body);
    str += "Content-Length: " + std::to_string(body.size()) + "\r\n\r\n";

    assert(socket.Send(str.c_str(), str.size()) != -1);
    assert(socket.Send(body.c_str(), body.size()) != -1);
    char buffer[1024] = {0};
    socket.Recv(buffer, sizeof(buffer) - 1);
    std::cout << buffer << std::endl;
    socket.Close();
    return 0;
}